
class ItemTab extends React.Component {
  render() {
    const { tabs = [], activeTab='', changeTab} = this.props;
    return (
      <div className='com-title-div'>
        {
          tabs.length>0 && tabs.map( (v, index)=> {
            let tabClass = ''
            if(index == 0) {
              tabClass = 'left-tab'
            } else if( index == 1) {
              tabClass = 'right-tab'
            }
            return (
              <p className={v.key == activeTab ? `active tab-item ${tabClass}` : `tab-item  ${tabClass}`} 
                 onClick={changeTab.bind(this, v.key)}>
                  {v.title}
              </p>
            )
          })
        }
      </div>
    )
  }
}

export default ItemTab